package com.ht.controller;

import com.ht.data.Result;
import com.ht.service.PopularizationService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.*;

/**
 * 科普号controller
 */
@RestController
@RequestMapping("popularization")
@Api
@RefreshScope //开启自动刷新配置
public class PopularizationController {

    @Autowired
    private PopularizationService popularizationService;

    /**
     * 根据科普号id修改科普号审核状态
     * @param popularizationId 科普号id
     * @param popularizationStatus 科普号状态
     * @return
     */
    @ApiOperation("根据科普号id修改科普号审核状态")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "popularizationId",value = "科普号id",required = true,paramType = "path",dataTypeClass = Long.class),
            @ApiImplicitParam(name = "popularizationStatus",value = "科普号审核状态1通过,2:不通过",required = true,paramType = "query",dataTypeClass = Integer.class)
    })
    @PutMapping("/{popularizationId}")
    public Result updatePopularizationStatusByPopularizationId(@PathVariable("popularizationId")Long popularizationId, @RequestParam("popularizationStatus") Integer popularizationStatus){
        return popularizationService.updatePopularizationStatusByPopularizationId(popularizationId,popularizationStatus);
    }


}
